import { AlovaInstance } from '@/utils/http/alova';

export interface Serial {
  baud: string;
}

export interface SerialMsg {
  errorCode: number;
  errorMsg: string;
  result: Serial;
}

/**
 * 获取串口配置
 */
export function getSerialConfig(): Promise<SerialMsg> {
  return AlovaInstance.Post('', {
    method: 'get',
    TTL: 'TTL',
  });
}

/**
 * 设置串口
 */
export function setSerialConfig(config: string): Promise<SerialMsg> {
  return AlovaInstance.Post('', {
    method: 'set',
    TTL: config,
  });
}
